Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Graphics /
Chapter 4 - Geometric Operations / Geometric Operations Reference
Functions / Determining and Reversing Contour Direction


GXGetShapeDirection

You can use the GXGetShapeDirection function to determine whether a contour has a clockwise or counterclockwise direction.

gxContourDirection GXGetShapeDirection(gxShape source, 
                                       long contour);
source
A reference to the shape containing the contour.
contour
The contour index of the contour whose direction you want to determine.
function result
The direction of the contour, either gxClockwiseDirection or gxCounterclockwiseDirection.
DESCRIPTION
The GXGetShapeDirection function indicates whether QuickDraw GX considers the contour indicated by the contour parameter of the shape indicated by the source parameter to be clockwise or counterclockwise. You can use this information to determine how QuickDraw GX will draw a shape that has the gxInsideFrameStyle or gxOutsideFrameStyle style attribute set, or how the GXInsetShape function affects a shape.

For empty and full shapes, this function posts the error graphic_type_does_not_have_multiple_contours.

For point shapes and line shapes, this function always returns gxClockwiseDirection. Although the order of the geometric points in a line shape's geometry does not affect the result of this function, it may affect how QuickDraw GX draws the line. For example, if the line is dashed, the order of the geometric points determines the end of the line at which dashing begins. Also, if the line has a pen width and the gxInsideFrameStyle or gxOutsideFrameStyle style attribute is set, the order of the geometric points determines the side of the geometry on which QuickDraw GX draws the line.

For rectangle shapes, the result of this function is determined by examining which corners are specified by the geometric points. For a rectangle whose geometry includes the upper-left point and the lower-right point, this function returns gxClockwiseDirection, regardless of the order of the two points in the geometry. For a rectangle whose geometry includes the upper-right point and the lower-left point, this function returns gxCounterclockwiseDirection, again regardless of the order of the two points.

For curve shapes, polygon shapes, and path shapes, reversing the order of any contour's geometric points reverses the result of this function.

If you provide a source shape that is not one of the geometric shape types, this function performs the actions described in the following table:
Shape typeAction taken
bitmapPosts the error graphic_type_does_not_have_multiple_contours
picturePosts the error graphic_type_does_not_have_multiple_contours
textPosts the error illegal_type_for_shape
glyphPosts the error illegal_type_for_shape
layoutPosts the error illegal_type_for_shape

ERRORS, WARNINGS, AND NOTICES
Errors 
out_of_memory 
shape_is_nil 
contour_is_less_than_zero(debugging version)
illegal_type_for_shape(debugging version)
graphic_type_does_not_have_multiple_contours(debugging version)
Warnings 
contour_out_of_range 
SEE ALSO
For examples using this function, see "Determining and Reversing Contour Direction" beginning on page 4-23.

To reverse the order of geometric points in a shape's geometry, use the GXReverseShape function, described in the next section.

For a description of the GXInsetShape function, see page 4-94. For a description of the gxInsideFrameStyle and gxOutsideFrameStyle style attributes, see Chapter 3, "Geometric Styles," in this book.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help